<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>MeteoCal - Invitations</title>
        <link rel="stylesheet" type="text/css" href="${request.contextPath}/resources/css/main.css" />
    </h:head>
    <h:body>
        <p:layout fullPage="true">
            <p:layoutUnit position="north" size="60" resizable="false" closable="false" collapsible="false">
                <ui:include src="/includes/header.xhtml"/>
            </p:layoutUnit>
            <p:layoutUnit position="center" class="content">
                <h1>Invitations</h1>
                <h:form>
                    
                    <h:outputText escape="false" value="#{bundle.ListInviteeEmpty}" rendered="#{inviteeController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{inviteeController.items.rowCount > 0}">
                    <h:outputText value="#{inviteeController.pagination.pageFirstItem + 1}..#{inviteeController.pagination.pageLastItem + 1}/#{inviteeController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{inviteeController.previousPage}" value="#{bundle.Previous}" rendered="#{inviteeController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{inviteeController.nextPage}" value="#{bundle.Next}" rendered="#{inviteeController.pagination.hasNextPage}"/>&nbsp;
                    
                    <h:dataTable value="#{inviteeController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Event name"/>
                            </f:facet>
			    <h:commandLink action="#{inviteeController.myInvitationEdit}" value="#{item.eventID.eventName}"/>
                        </h:column>
			<h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListInviteeTitle_accepted}"/>
                            </f:facet>
                            <h:outputText value="#{item.accepted ? 'accepted already':'not accepted yet'}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Notification"/>
                            </f:facet>
                            <h:outputText value="#{item.eventID.eventNotification ? 'Cancellation':'On time'}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Organizer"/>
                            </f:facet>
                            #{item.eventID.userEmail.userFirstName} #{item.eventID.userEmail.userLastName}
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{inviteeController.myInvitationEdit}" value="Edit"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{inviteeController.inviteeDestroy}" value="Delete"/>
                        </h:column>
                    </h:dataTable>
                    </h:panelGroup>
                </h:form>
            </p:layoutUnit>
            <p:layoutUnit position="south" size="80" resizable="false" closable="false" collapsible="false">
                <ui:include src="/includes/footer.xhtml"/>
            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>
